package com.xxl.job.executor.service.jobhandler;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.executor.service.service.JobService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author 小刘
 * @description
 * @date 2021/12/4
 */

@Component
public class JobDemo {
    private static Logger logger = LoggerFactory.getLogger(JobDemo.class);


    @Autowired
    private JobService jobService;


    /**
     * 1、简单任务示例（Bean模式）
     */
    @XxlJob("demoTset")
    public void demoJobHandler() {

        for(int i = 0;i<10;i++)
        {
            XxlJobHelper.log("这是小刘的xxl-job启动成功！！！");

        }

        List<Map> map = jobService.getMyData();
        List<Map> map2 = jobService.getMyData2();
        System.out.println(map);
        System.out.println(map2);
    }

}
